package com.ruoyi.life.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.life.mapper.FeFacilityMapper;
import com.ruoyi.omp.api.domain.FeFacility;
import com.ruoyi.life.service.IFeFacilityService;

/**
 * 设施费用Service业务层处理
 *
 * @author cjie
 * @date 2021-09-17
 */
@Service
public class FeFacilityServiceImpl implements IFeFacilityService {
    @Autowired
    private FeFacilityMapper feFacilityMapper;

    /**
     * 查询设施费用
     *
     * @param id 设施费用ID
     * @return 设施费用
     */
    @Override
    public FeFacility selectFeFacilityById(String id) {
        return feFacilityMapper.selectFeFacilityById(id);
    }

    /**
     * 查询设施费用列表
     *
     * @param feFacility 设施费用
     * @return 设施费用
     */
    @Override
    public List<FeFacility> selectFeFacilityList(FeFacility feFacility) {
        return feFacilityMapper.selectFeFacilityList(feFacility);
    }

    /**
     * 新增设施费用
     *
     * @param feFacility 设施费用
     * @return 结果
     */
    @Override
    public int insertFeFacility(FeFacility feFacility) {
        feFacility.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        feFacility.setCreateTime(DateUtils.getNowDate());
        feFacility.setCreateBy(SecurityUtils.getUsername());
        return feFacilityMapper.insertFeFacility(feFacility);
    }

    /**
     * 修改设施费用
     *
     * @param feFacility 设施费用
     * @return 结果
     */
    @Override
    public int updateFeFacility(FeFacility feFacility) {
        feFacility.setUpdateTime(DateUtils.getNowDate());
        feFacility.setUpdateBy(SecurityUtils.getUsername());
        return feFacilityMapper.updateFeFacility(feFacility);
    }

    /**
     * 批量删除设施费用
     *
     * @param ids 需要删除的设施费用ID
     * @return 结果
     */
    @Override
    public int deleteFeFacilityByIds(String[] ids) {
        return feFacilityMapper.deleteFeFacilityByIds(ids);
    }

    /**
     * 删除设施费用信息
     *
     * @param id 设施费用ID
     * @return 结果
     */
    @Override
    public int deleteFeFacilityById(String id) {
        return feFacilityMapper.deleteFeFacilityById(id);
    }
}
